def climbStairs(n):  
    if n <= 2:  
        return n  
      
    # 初始化dp数组  
    dp = [0] * (n + 1)  
    dp[0] = 1  
    dp[1] = 1  
      
    # 动态规划计算每一阶的方法数  
    for i in range(2, n + 1):  
        dp[i] = dp[i - 1] + dp[i - 2]  
      
    return dp[n]  
  
# 测试和结果  
print(climbStairs(2))  # 输出: 2  
print(climbStairs(3))  # 输出: 3  
print(climbStairs(10)) # 输出: 89